For this example we will try to show the previous analysis the relationship between MPG (Miles Per Gallon) and types of vehicle (automatic/ manual)
library(plotly) library(webshot) data(mtcars) mtcars$cyl <- as.factor(mtcars$cyl)
p1 <- plot_ly( data = mtcars, y = ~mpg, x = ~hp, color = ~cyl )